import { createRouter,createWebHashHistory, onBeforeRouteUpdate } from "vue-router";
import Home from '@frontend/views/home.vue'
import Empty from '@frontend/views/emptypage.vue'
import Chat from '@frontend/views/chat/mutiContainer.vue'
import { createRouteName } from '@frontend/views/public/publicMethods.js'
import $eventer from '@events'
import CONST from './routeConf'
// @LINKS: 路由配置 => 总配置入口
const routers = [{
    path:'/',
    name: CONST.HOME,
    component:Home
},{
    path: `/${CONST.CHAT}/:code`,
    name: CONST.CHAT,
    component: Chat
},{
    path: '/'+CONST.EMPTY,
    name: CONST.EMPTY,
    component: Empty
}]

export const routes = createRouter({
    history: createWebHashHistory(),
    routes: routers
})
routes.beforeEach(($r)=>{
    $eventer.$emit('route-change', $r)
})
console.log(routes)
// export function initRoute( app ){
//     $eventer.$on('sys-tab-active-changed', (actName, actVo) => {
//         app.$router.push({path: actVo.route})
//     })
// }

export default routes